from ogms import ServiceCollection

server = ServiceCollection.CreateServer("127.0.0.1", 8060)
sa = server.getServiceAccess()
swmm = sa.getModelServiceByID("6881f6a978f3b34dd7b53614")

dat_inp = sa.uploadDataByFile("img", "G:\\Download\\DSC_3663_P.jpg")
recordid = swmm.invoke([sa.createDataConfigurationItem("Run", "LoadImage", dat_inp)])

record = sa.getModelServiceRunningRecordByID(recordid)
record.wait4Finished()

record.refresh()

for index, item in enumerate(record.outputs):
    dat = sa.getDataByID(item.dataid)
    data_value = dat.value
    ext = data_value[data_value.rfind('.') + 1:]
    dat.save("E:\\DemoData\\GeoModeling\\SWMM\\output_tmp\\" + item.eventname + '.' + ext)